// 水平动画
const flyX = (bottomX, ballX, duration) => {
	/**
	 * bottomX 结束位置
	 * ballX 开始位置
	 * duration 动画持续时间
	 */
	let animation = uni.createAnimation({
		duration: duration || 400,
		timingFunction: 'linear',
	})
	animation.translateX(bottomX-ballX).step(); // 动画效果
	return animation;
},
		// 垂直动画
const	flyY = (bottomY, ballY, duration) => {
	/**
	 * bottomY 结束位置
	 * ballY 开始位置
	 * duration 动画持续时间
	 */
	let animation = uni.createAnimation({
		duration: duration || 400,
		timingFunction: 'ease-in',
	})
	console.log(bottomY)
	animation.translateY(bottomY-ballY).step(); // 动画效果
	return animation;
}
// 延迟执行
const setDelayTime = (sec) => {
	return new Promise((resolve, reject) => {
		setTimeout(() => {resolve()}, sec)
	});
}
module.exports = {
	flyX:flyX,
	flyY:flyY,
	setDelayTime:setDelayTime
}